//
//  LoginAlertView.m
//  wsgz
//
//  Created by huck on 2017/5/11.
//  Copyright © 2017年 BoingPay. All rights reserved.
//

#import "LoginAlertView.h"
#import "AppUtils.h"
#import "LoginViewController.h"


@interface LoginAlertView()<CustomIOSAlertViewDelegate>
{
    LoginAlertContainer *contentView;
}

@end

@implementation LoginAlertView

-(id)init{
    self = [super init];
    if (self) {
        [self initCustomView];
    }
    return  self;
}

-(void)initCustomView{
    self.containerView = [self createAlertContentView];
    self.delegate = self;
    self.buttonTitles = nil;
}

-(UIView*)createAlertContentView
{
    if(contentView==nil){
        contentView = [[[NSBundle mainBundle] loadNibNamed:@"LoginAlertView" owner:self options:nil] firstObject];
    }
    return contentView;
}

#pragma mark CustomIOSAlertViewDelegate
- (void)customIOS7dialogButtonTouchUpInside:(id)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    [self close];
}

@end



/**
 *  ///////////////////内容容器////////////////////////////
 */

@implementation LoginAlertContainer

-(void)awakeFromNib
{
    [super awakeFromNib];
    [self initSubview];
}

-(void)initSubview
{
    self.width = ATValue(270);
    self.height = ATValue(170);
}

- (IBAction)sureBtnClick:(UIButton *)sender
{
    UIView *alertView = self.superview.superview;
    if([alertView respondsToSelector:@selector(close)]){
        [alertView performSelector:@selector(close)];
    }
    LoginViewController *controller = [[LoginViewController alloc] init];
    [[AppUtils getNavigationController] pushViewController:controller animated:YES];
}
@end
